{% load i18n %}
<tr {% if not notifier.enabled %}class="promgen-disabled"{% endif %}>
    <td class="col-xs-2" title="Added by: {{notifier.owner}}" v-pre>{{ notifier.sender }}</td>
    <td class="col-xs-5" style="word-break: break-all;" v-pre>{{ notifier.show_value }}</td>
    <td class="col-xs-2">
        {% for f in notifier.filter_set.all %}
            {% if show_edit %}
            <form method="post" action="{% url 'notifier-edit' notifier.id %}" onsubmit="return confirm('Delete this filter?')" style="display: inline">
                {% csrf_token %}
                <input name="next" type="hidden" value="{{ request.get_full_path }}#notifiers" />
                <input name="filter.pk" value="{{f.id}}" type="hidden" />
                <button class="label label-primary" style="display: inline-block;" v-pre>
                    {{f.name}}:{{f.value}}
                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                </button>
            </form>
            {% else %}
            <span class="label label-primary" style="display: inline-block;">
                {{f.name}}:{{f.value}}
            </span>
            {% endif %}
        {% endfor %}

        {% if show_edit %}
        <button class="btn btn-primary btn-xs" data-toggle="collapse" data-target="#notifierLabel{{notifier.id}}">+</button>
        {% endif %}
        <div class="collapse" id="notifierLabel{{notifier.id}}">
            <form method="post" action="{% url 'notifier-edit' notifier.id %}" style="display: inline">
                {% csrf_token %}
                <input name="next" type="hidden" value="{{ request.get_full_path }}#notifiers" />
                <input name="filter.name" placeholder="name" required list="common.labels" @change="setTargetList($event, 'newLabel{{notifier.id}}')">
                <input name="filter.value" placeholder="value" required id="newLabel{{notifier.id}}">
                <button class="btn btn-primary btn-xs">Submit</button>
            </form>
        </div>
    </td>
    {% if show_edit %}
    <td class="col-xs-3">
        <input
            type="checkbox"
            {% if notifier.enabled %}checked{% endif %}
            data-size="mini"
            data-toggle="toggle"
            data-csrfmiddlewaretoken="{{csrf_token}}"
            data-action="{% url 'notifier-toggle' notifier.id %}"
        />
        <a href="{% url 'notifier-edit' notifier.id %}" class="btn btn-warning btn-xs">{% trans "Edit" %}</a>
        <form method="post" action="{% url 'notifier-test' notifier.id %}" style="display: inline">
            {% csrf_token %}
            <input name="next" type="hidden" value="{{ request.get_full_path }}#notifiers" />
            <button class="btn btn-info btn-xs">{% trans "Test" %}</button>
        </form>
        <form method="post" action="{% url 'notifier-delete' notifier.id %}" onsubmit="return confirm('{% trans "Delete notification?" %}')" style="display: inline">
            {% csrf_token %}
            <button class="btn btn-danger btn-xs">{% trans "Delete" %}</button>
        </form>
    </td>
    {% endif %}
</tr>
